package com.ruicar.afs.cloud.product.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.product.entity.WorkApproveRecord;
import com.ruicar.afs.cloud.product.service.WorkApproveRecordService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Description 审批记录
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/approveRecord")
public class ApproveRecordController {
    private final WorkApproveRecordService workApproveRecordService;

    /**
     * @Description 查询置顶申请编号所有操作记录
     */
    @GetMapping("/listAllRecord")
    public IResponse listAllRecord(@RequestParam String stageId) {
        return IResponse.success(workApproveRecordService.list(Wrappers.<WorkApproveRecord>lambdaQuery()
                .eq(WorkApproveRecord::getStageId, stageId)
                .orderByDesc(WorkApproveRecord::getApproveEndTime)));
    }

}
